package com.neuedu.controller;

import com.github.pagehelper.PageInfo;
import com.neuedu.bean.Food;
import com.neuedu.common.R;
import com.neuedu.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/employee")
public class EmployeeController {

    @Autowired
    private FoodService foodService;

    /**
     * 查询菜品列表
     * @param pageNumber  当前面
     * @param pageSize    每页显示数量
//     * @param food        筛选条件
     * @return
     */
    @GetMapping("/queryFoodPageList")
    public R queryFoodPageList(@RequestParam("page") int pageNumber , @RequestParam("size") int pageSize/*, @RequestBody(required = false) Food food*/){
        List<Food> foodList = foodService.queryFoodPageList(pageNumber,pageSize);
        // 进行分页
        PageInfo<Food> pageInfo = new PageInfo<>(foodList);
        return R.ok().data(pageInfo);
    }
}
